<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use DB;
class SetController extends Controller
{
     // 检测用户是否登录，无登录跳转到登录页面
    public function __construct()
    {
       $this->middleware('auth');
    }
    //支付设置
    public function index(){

    	$app = DB::table('app_set')->find(1);

    	return view('staticpages.appset',compact('app'));
    }
 

    //更新app状态
    public function update($id,Request $request){

    	//获取提交字段
    	$data = $request->only(['status','created_at']);
    	//获取当期那时间
    	$data['created_at'] = date('Y-m-d H:i:s');

    	//更新数据
    	$status = DB::table('app_set')->update($data);

    	if($status){

    		return back();

    	}else{

    		return '修改失败';
    	}

    }
}
